home *** CD-ROM | disk | FTP | other *** search
/ CD World 1998 January / CD World - Ocak 1998.iso / misc / dbase55 / disk7 / utils.pak / SQLDBASE.DBT (.txt) < prev    next >
dBase/FoxBase/XBase/FoxPro Database File  |  1996-01-05  |  9KB  |  141 lines

  1. SQLDBASE
  2. use Animals
  3. set fields to
  4. 1513R
  5. use in Animalset fields to
  6. 1513R
  7. select name, street from Customer order by name
  8. 1513R
  9. use Customer order name
  10. set fields to name, street3
  11. 1513R
  12. use in Customer
  13. set fields toields to name, street3
  14. 1513R
  15. select distinct;
  16.    C.name, O.order_no, L.stock_no, L.qty, L.sell_price;
  17.    from  orders O, customer C, lineitem L;
  18.    where C.customer_n = O.customer_n;
  19.       and O.order_no = L.order_no;
  20.    order by C.name
  21. 1513R
  22. use Customer order name in select()
  23. use Orders order customer_n in select()
  24. use Lineitem order order_no in select()
  25. select Customer
  26. set relation to customer_n into Orders constrain
  27. select Orders
  28. set relation to order_no into Lineitem constrain
  29. select Customer
  30. set skip to Orders, Lineitem
  31. set fields to Customer->name, Orders->order_no, ;
  32.    Lineitem->stock_no, Lineitem->qty, ;
  33.    Lineitem->sell_price
  34. use in Lineitem
  35. use in Orders
  36. use in Customer
  37. set fields to_n in select()
  38. use lineitem order order_no in select()
  39. select customer
  40. set relation to customer_n into orders constrain
  41. select orders
  42. set relation to order_no into lineitem constrain
  43. select customer
  44. set skip to orders, lineitem
  45. set fields to customer->name, orders->order_no, ;
  46.    lineitem->stock_no, lineitem->qty, ;
  47.    lineitem->sell_price
  48. select C.name, sum(O.amt_paid) total_paid;
  49.    from  Customer C, Orders O;
  50.    where C.customer_n = O.customer_n;
  51.    group by customer_n  having min(amt_paid) > 1500o orders constrain
  52. select orders
  53. set relation to order_no into lineitem constrain
  54. select customer
  55. set skip to orders, lineitem
  56. set fields to customer->name, orders->order_no, ;
  57.    lineitem->stock_no, lineitem->qty, ;
  58.    lineitem->sell_price
  59. use Customer in select() order customer_n exclusive
  60. select Customer
  61. append blank
  62. replace name with "dBASE Customer", customer_n with "0000"
  63. set fields to Customer->name, Customer->customer_nrders
  64. set relation to order_no into lineitem constrain
  65. select customer
  66. set skip to orders, lineitem
  67. set fields to customer->name, orders->order_no, ;
  68.    lineitem->stock_no, lineitem->qty, ;
  69.    lineitem->sell_price
  70. delete from Customer where customer_n = "0000"usive
  71. select customer
  72. append blank
  73. replace name with "dBASE Customer", customer_n with "0000"
  74. set fields to customer->name, customer->customer_nrders
  75. set relation to order_no into lineitem constrain
  76. select customer
  77. set skip to orders, lineitem
  78. set fields to customer->name, orders->order_no, ;
  79.    lineitem->stock_no, lineitem->qty, ;
  80.    lineitem->sell_price
  81. select * from Animals "0000"
  82. delete
  83. use in customer
  84. set fields tond blank
  85. replace name with "dBASE Customer", customer_n with "0000"
  86. set fields to customer->name, customer->customer_nrders
  87. set relation to order_no into lineitem constrain
  88. select customer
  89. set skip to orders, lineitem
  90. set fields to customer->name, orders->order_no, ;
  91.    lineitem->stock_no, lineitem->qty, ;
  92.    lineitem->sell_price
  93. select Customer
  94. seek "0000"
  95. delete
  96. use in Customer
  97. set fields to
  98. use Orders order customer_n in select()
  99. select Orders
  100. total on customer_n to Total0 fields amt_paid
  101. use Total0  
  102. use Customer in select()
  103. join with Customer to Total1;
  104.    for customer_n = Customer->customer_n .and.;
  105.       Total0->amt_paid > 1500;
  106.    fields customer->name, Total0->amt_paid
  107. use Total1 exclusive
  108. index on name tag name
  109. go top
  110. wwwwww
  111. wwpwww
  112. wwpwww
  113. wwwwww
  114. wwwwww
  115. use in Customer
  116. use in Total1
  117. delete table Total0
  118. delete table Total1o;
  119.    where c.customer_n = o.customer_n;
  120.    group by customer_n  && having min(amt_paid) > 500 500
  121. insert into Customer (name, customer_n);
  122.     values ("SQL Customer", "0000")
  123. select name, customer_n from Customer order by customer_nect()
  124. join with Customer to Total1;
  125.    for customer_n = customer->customer_n;
  126.    fields customer->name, total->amt_paid
  127. use Total1 excl
  128. index on name tag name
  129. go top
  130. VhL @
  131. t&h\ @
  132. select C.name, sum(O.amt_paid) total_paid;
  133.    from  Customer C, Orders O;
  134.    where C.customer_n = O.customer_n;
  135.    group by customer_n  having min(O.amt_paid) > 1500al1;
  136.    for customer_n = Customer->customer_n;
  137.    fields customer->name, Total0->amt_paid
  138. use Total1 exclusive
  139. index on name tag name
  140. go topD
  141.